/*
 * @Author: c
 * @Date: 2024-01-20 14:29:42
 * @LastEditTime: 2024-02-27 13:20:21
 * @LastEditors: c
 * @Description:
 * @FilePath: \music-web-admin\src\api\application\video\index.ts
 * https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { Delete, Get, Post, Put } from "@/http/http";
import {
  TrackLinkQueryDto,
  TrackLinkVO,
  VideoForm,
  VideoQuery,
  VideoVO,
} from "./types";

/**
 * 类别-下拉列表-获取
 *
 * @param queryParams
 */
export function getVideoOptions(): Promise<OptionType[]> {
  return Get("/api/v1/video/options");
}

/**
 * 歌曲-列表-获取
 * @param queryParams
 * @returns
 */
export function listVideos(
  queryParams: VideoQuery
): Promise<PageResult<VideoVO[]>> {
  return Get("/api/v1/video/page", queryParams);
}

/**
 * 歌曲-下拉选项-获取
 * @param queryParams
 * @returns
 */
export function listVideoOptions(
  queryParams: VideoQuery
): Promise<OptionType[]> {
  return Get("/api/v1/video/options", queryParams);
}

/**
 * 歌曲-表单数据-获取
 *
 * @param id
 */
export function getVideoForm(id: number): Promise<VideoForm> {
  return Get("/api/v1/video/" + id + "/form");
}
/**
 * 歌曲-表单数据-获取
 *
 * @param id
 */
export function getTracklink(parms: TrackLinkQueryDto): Promise<TrackLinkVO> {
  return Get("/api/v1/video/tracklink", parms);
}

/**
 * 歌曲-新增
 *
 * @param data
 */
export function addVideo(data: VideoForm) {
  return Post("/api/v1/video", data);
}

/**
 * 歌曲-修改
 *
 * @param id
 * @param data
 */
export function updateVideo(id: string, data: VideoForm) {
  return Put("/api/v1/video/" + id, data);
}

/**
 * 歌曲-删除
 *
 * @param id 歌曲ID
 */
export function deleteVideo(ids: string[] | string) {
  return Delete("/api/v1/video/" + ids);
}
/**
 * 歌曲-封面-删除
 *
 * @param id 歌曲ID
 */
export function deleteCoverPic(id: number, picId: string) {
  return Delete(`/api/v1/video/deletepic/${id}/${picId}`);
}
/**
 * 歌曲-音频列表-删除
 *
 * @param id 歌曲ID
 */
export function deleteRateFiles(id: number, rateIds: number[]) {
  return Delete(`/api/v1/video/delrates/${id}/${rateIds}`);
}
